// JavaScript Document
//标签切换

function setTab(m,n){
	  var menu=document.getElementById("tab"+m).getElementsByTagName("li"); 
	  var showdiv=document.getElementById("tab_cont"+m).getElementsByTagName("ul");  
	  for(i=0;i<menu.length;i++)
	  {
		  menu[i].className=i==n?"current":"";   
		  showdiv[i].style.display=i==n?"block":"none";  
	  }
} 
 


 
 //---------------------今日话题轮播------------------
 
	function focusPic1(){
		var actionList = new Array();
		$("#play1").queue('playList',actionList);
		
		
		var t = n = 0, count = $("#playShow1 a").size();
		$("#playShow1 a:not(:first-child)").hide();
		$("#playText").html(
			$("#playShow1 a:first-child").find("img").attr('alt')
		);
		$("#playNum1 a:first").addClass("num_current");
		$("#playText").click(function(){
			window.open($("#playShow1 a:first-child").attr('href'), "_blank");
		});
		
		function mouseAction(i){
		   if (i >= count) return;

		   $("#playText").html($("#playShow1 a").eq(i).find("img").attr('alt'));
		   $("#playText").unbind().click(function(){
				window.open($("#playShow1 a").eq(i).attr('href'), "_blank");
			});
		   $("#play1").queue('playList',function(){
				$("#playShow1 a").filter(":visible").hide().parent().children().eq(i).fadeIn(1000);									 
			});
		   $("#playNum1 a").eq(i).addClass("num_current").siblings().removeClass("num_current");	
		}
		
		$("#playNum1 a").mouseover(function(){
		   var i = $(this).text() - 1;
		   n = i;
		   $("#play1").clearQueue('playList');
		   
		   mouseAction(n);
		   
		   $("#play1").dequeue('playList');
		   return ;
		});
		
		function showAuto()
		{
			n = n >= (count - 1) ? 0 : ++n;
			$("#play1").clearQueue('playList');
			mouseAction(n);
			actionList;
			$("#play1").dequeue('playList');
			//$("#playNum1 a").eq(n).trigger('mousemove');
		}
		
		t = setInterval(function(){
			showAuto();
		}, 5000);
		
		$("#play1").hover(
			function(){clearInterval(t);},
			function(){t = setInterval(function(){showAuto()}, 5000);}
		);		
		
	}
	
$(document).ready(function(){
	focusPic1();		
	
	 //---------------------左右视频轮播------------------
	var $lists = $(".CRslide li");
	var length = $lists.length;
	var i = 0;
	/*下一张*/
	$(".nextLink").click(function(){
		i++;
		if( i > (length-1)){
			i = 0 ;
		}
		showImg(i);
		return false;
	});
	/*上一张*/
	$(".prevLink").click(function(){
		i--;
		if( i < 0){
			i = length-1 ;
		}
		showImg(i);
		return false;
	});

	$("a").focus(function(){
		$(this).blur();
		return false;
	});

	function showImg(i) {
		$lists.hide().eq(i).show(); 
	}

	showImg(0);//进入页面初始化 


});





